package com.xqls.ssm005.controller;

import com.xqls.ssm005.entity.Person;
import com.xqls.ssm005.entity.User;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@RestController
public class SayController {

    private Map<String,String> map = new HashMap<>();
    @PostMapping(path = "/say")
    public Object test1(@RequestParam("uid") String uid){
        map.clear();
        map.put("uid",uid);
        return map;
    }

    @PostMapping(path = "/tall")
    public Object test2(@RequestParam(name = "uid",defaultValue = "sss") String uids){
        map.clear();
        map.put("uid",uids);
        return map;
    }

    @PostMapping(path = "/usera")
    public Object test3(@RequestBody User user){
       Map<String,User> maps = new HashMap<>();
       maps.put("user",user);
       return maps;
    }

    @PostMapping(path = "/test1")
    public Object test4(@RequestHeader("token")String token){
        map.clear();
        map.put("tocken",token);
        return map;
    }

    @RequestMapping(path = "/json1",method = RequestMethod.GET)
    public Object test5(){
        Person person = new Person(1,"小桥流水","123123",new Date());
        return person;
    }
}
